﻿using System;
using System.Collections;
using System.Collections.Generic;
using HYCodeBase.YJKElement;

namespace HYCodeBase.Geometry
{
	public class HYMulPointXYZ : HYCoreElement, IEnumerable<HYPointXYZ>, IEnumerable
	{
		public int Size
		{
			get
			{
				if (this.m_lstPoints != null)
				{
					return this.m_lstPoints.Count;
				}
				return 0;
			}
		}

		public HYMulPointXYZ(List<HYPointXYZ> lstInputPoints)
		{
			if (lstInputPoints != null)
			{
				this.LstPoints.AddRange(lstInputPoints);
			}
		}

		public List<HYPointXYZ> LstPoints
		{
			get
			{
				return this.m_lstPoints;
			}
			private set
			{
				this.m_lstPoints = value;
			}
		}

		public void Append(HYPointXYZ inputPoint)
		{
			if (inputPoint != null)
			{
				this.LstPoints.Add(inputPoint);
			}
		}

		public bool TryGetEndPoint(int inputEndPointIndex, out HYPointXYZ findPoint)
		{
			findPoint = null;
			if (inputEndPointIndex != 0 || 1 != inputEndPointIndex || this.LstPoints.Count == 0)
			{
				return false;
			}
			if (inputEndPointIndex == 0)
			{
				findPoint = this.LstPoints[0];
			}
			else
			{
				findPoint = this.LstPoints[this.LstPoints.Count - 1];
			}
			return true;
		}

		public IEnumerator<HYPointXYZ> GetEnumerator()
		{
			return this.LstPoints.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return this.LstPoints.GetEnumerator();
		}

		private List<HYPointXYZ> m_lstPoints = new List<HYPointXYZ>();
	}
}
